﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using DBLClient.DBLAdminConfigService;
namespace DBLClient.DBLForm
{
    public partial class EditUserLevelForm : Form
    {
        public EditUserLevelForm()
        {
            InitializeComponent();
        }

        private void buttonEdit_Click(object sender, EventArgs e)
        {
            //拿到id

            if (dataGridView1.CurrentRow == null)
            {
                //请选中编辑的一行
                MessageBox.Show("请选中编辑的一行");
                return;
            }

            int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["id"].Value);

            AddUserLevelForm adduserlevelform = new AddUserLevelForm("U",id);
            adduserlevelform.Show();        
            
        }

        private void buttonAdd_Click(object sender, EventArgs e)
        {
            AddUserLevelForm adduserlevelform = new AddUserLevelForm("A", 0);
            adduserlevelform.Show();
        }

        private void buttonSearch_Click(object sender, EventArgs e)
        {
            string searchWord = textBoxSearchWord.Text;
            AdminConfigService service = new AdminConfigService();
            DataSet ds = service.FindUserLevelByName(searchWord);
            dataGridView1.DataSource = ds.Tables[0];
        }
    }
}
